var form = layui.form;
var layer = parent.layer === undefined ? layui.layer : top.layer;
$ = layui.jquery;
function sub(data){
    var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.5});
    // 实际使用时的提交信息
    $.ajaxSettings.async = false;
    $.post("/sysDictInfoController/insertDict",{
        pid : $("#pid").val(),
        name : $(".name").val(),
        mark : $(".mark").val(),
        describe : $(".describe").val()
    },function(res){
        if(res.code==0){
            layer.msg(res.msg);
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        }else {
            layer.msg(res.msg);
        }
    })
}
$.ajax({
    url:"/sysDictInfoController/findParentDict",
    type:"post",
    dataType:"json",
    success:function(result){
        var options = "<option value='0'>设为父级菜单</option>";
        for(var i=0;i<result.length;i++){
            options += '<option value="'+result[i].id+'" >'+result[i].name+'</option>';
        }
        $("#pid").html(options);
        form.render();
    }
});